package com.itheima.app.interceptor;

import com.itheima.domain.db.User;

public class UserHolder {
    private static ThreadLocal<User> local = new ThreadLocal<>();

    public static void setLocal(User user) {
        local.set(user);

    }

    public static User getLocal() {
        return local.get();
    }

    public static Long getLocalUserId() {
        return local.get().getId();
    }

    public static void remove() {
        local.remove();

    }
}
